package com.briup.day06;

/**
 * 账户类
 * @author lining
 * @date 2024/1/15 15:05
 */
public class Account {
    //定义属性
    private String id;
    private double balance; //0.0
    private boolean used = true;//默认卡可用 是否可用

    //定义构造器 无参构造器
    public Account(){
        this.used = true;
    }
    public Account(String id){
        this.id = id;
        System.out.println(this.balance);//0.0
    }

    //定义有参构造器，会覆盖无参构造器，需要显式指定无参构造器
    public Account(String id,double balance){
        this.id = id;
        this.balance = balance;
    }



    //定义get/set方法

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    //定义toString

    @Override
    public String toString() {
        return "Account{" +
                "id='" + id + '\'' +
                ", balance=" + balance +
                '}';
    }
}
